package chapter5.section3;

/**
 * 程序 5-5：一个能够对账户进行转账的程序
 * @author 张玮婷 20245080902061
 */

public class BankService {
    //转账业务，从src向dest对象转amount
    public void transfer(Account2 src, Account2 dest, int amount){
        src.withdraw(amount);
        dest.deposit(amount);
    }
    public static void main(String[]args){
        Account2 a1=new Account2("001","鲁宁",1000);
        Account2 a2=new Account2("002","梁丽",800);
        BankService bs=new BankService();
        bs.transfer(a1,a2,100);
        System.out.println("鲁宁还有"+a1.getBalance());
        System.out.println("梁丽还有"+a2.getBalance());
    }
}
